package com.example.service;

import com.example.entity.OrganizationActivity;
import com.example.entity.TransferProcess;
import com.example.mapper.TransferProcessMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TransferProcessService {

    @Resource
    TransferProcessMapper transferProcessMapper;

    public void add(TransferProcess transferProcess) {
        transferProcessMapper.insertTransferProcess(transferProcess);
    }

    public void updateById(TransferProcess transferProcess) {
        transferProcessMapper.updateTransferProcess(transferProcess);
    }

    public void deleteByUserId(Integer userId) {
        transferProcessMapper.deleteTransferProcessById(userId);
    }

    public List<TransferProcess> selectByUserId(String studentId) {
        return transferProcessMapper.selectTransferProcessById(studentId);
    }

    public List<TransferProcess> selectAll(TransferProcess transferProcess) {
        return transferProcessMapper.selectAllTransferProcesses(transferProcess);
    }

    public PageInfo<TransferProcess> selectPage(TransferProcess transferProcess, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<TransferProcess> list = transferProcessMapper.selectAllTransferProcesses(transferProcess);
        return new PageInfo<>(list);
    }
}
